package com.zqxq.lottery.api.controller;

import com.zqxq.common.constant.Result;
import com.zqxq.lottery.api.feign.LotteryServerFeignClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

@Api(value = "系统配置参数接口",tags = "系统配置参数接口")
@RestController
@Slf4j
@RequestMapping(value = "/sysConfig", produces = "application/json")
public class SysConfigController {
    @Autowired
    private LotteryServerFeignClient lotteryServerFeignClient;
    @PostMapping("/get")
    @ApiOperation(value = "系统配置参数获取", notes = "系统配置参数获取")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "configKey", value = "configKey", required = true,dataType = "String", paramType = "query"),
    })
    public Result getSysConfig(HttpServletRequest request, String configKey){
        String appKey = request.getParameter("appKey");
        return lotteryServerFeignClient.queryConfigValue(appKey,configKey);
    }
}
